<?php
/**
 * @package Simple_Login_IP_Limit
 * @version 0.1
 */
/*
Plugin Name: simple-login-ip-limit
Plugin URI: http://simple-login-ip-limit/
Description: This plugin is just for limit from ip access for wp admin
Author: stutiredboy at gmail dot com
Version: 0.1
Author URI: http://blog.chenxiaosheng.com
*/
function IsValidIp()
{
  if($_SERVER['HTTP_CLIENT_IP']){
    $onlineip=$_SERVER['HTTP_CLIENT_IP'];
  }elseif($_SERVER['HTTP_X_FORWARDED_FOR']){
    $onlineip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  }else{
    $onlineip=$_SERVER['REMOTE_ADDR'];
  }
  if($onlineip!="106.187.48.119"){
    wp_logout();
  }
}

add_action( 'wp_login', 'IsValidIp' );
